import 'normalize.css'
import '@/styles/index.scss'
import React from 'react'
// import logo from './logo.svg';
import Layout from '@/layout/index'
import authorityComponent from '@/components/AuthorityComponent/AuthorityComponent'
// import { Button } from 'antd';
// import 'antd/dist/antd.css'; //因为已经配置按需加载所以不用引入了
// import { ReactComponent as Logo } from './logo.svg'
import { Route, Switch } from "react-router";
//引入一级路由
import { constantRoutes } from '@/router/index'
// 思路 生成Route拼接上<Route exact path="*" render={ () => <Layout /> }/>
import './App.css';




function App() {

  const topLevelRoute = constantRoutes

  const routes = topLevelRoute.map( o => <Route key={ o.path } exact path={ o.path } render={ () => o.component?<o.component />:'' }/>  )
  
  return (
    <Switch>
      {/* <Route exact path="/login" render={ () => <div>login</div> }/> 
      <Route exact path="/404" render={ () => <div>404</div> }/> */}
      {
        routes
      }
      <Route  path="*" render={ () => <Layout /> }/>
    </Switch>
  );
}

export default authorityComponent(App);
